package cn.yy.cloudpay.view;

import cn.yy.cloudpay.R;
import cn.yy.cloudpay.listener.ITitlebarClickListener;
import android.content.Context;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.ImageView;
import android.widget.RelativeLayout;
import android.widget.TextView;

public class TitlebarLayout implements OnClickListener {

//	private Context mContext;
	private RelativeLayout mRelativeLayout;
	private String mTitle;

	private ITitlebarClickListener mListener;

	private ImageView imageView;
	private TextView textView;

	public TitlebarLayout(Context context, RelativeLayout relativeLayout,
			String title) {
//		this.mContext = context;
		this.mRelativeLayout = relativeLayout;
		this.mTitle = title;
		initView();
	}

	private void initView() {
		imageView = (ImageView) mRelativeLayout
				.findViewById(R.id.iv_layout_titlebar);
		imageView.setOnClickListener(this);
		textView = (TextView) mRelativeLayout
				.findViewById(R.id.tv_layout_tilebar);
		textView.setText(mTitle);
	}

	@Override
	public void onClick(View v) {
		switch (v.getId()) {
		case R.id.iv_layout_titlebar:
			mListener.OnRetrunListener(v);
			break;
		default:
			break;
		}
	}

	public void setTitlebarClickListener(ITitlebarClickListener listener) {
		this.mListener = listener;
	}
}
